local duf = _G.DeclarativeUnitFrames

duf.Utils = {}

local utils = duf.Utils

function duf:DeclareUtils(t, state)
	for name in pairs(state.utils) do
		table.insert(t, 2, ("local %s = DeclarativeUnitFrames.Utils.%s"):format(name, name))
	end
end

function duf:RegisterUtil(state, name)
	local u = state.utils
	if not u then
		u = {}
		state.utils = u
	end
	u[name] = true
end

function utils.GetColor(...)
	if select("#", ...) == 1 then
		if ... == "red" then
			return 1, 0, 0
		elseif ... == "green" then
			return 0, 1, 0
		elseif ... == "blue" then
			return 0, 0, 1
		end
	else
		return ...
	end
end
